cmake_minimum_required(VERSION 3.19)

# 项目名称
project(Aero)

# 设置编译参数
set(CMAKE_CXX_COMPILER "g++")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_BUILD_TYPE Debug)

enable_testing()

# 设置可执行文件输出目录
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

# 包含项目的头文件目录
include_directories(${PROJECT_SOURCE_DIR}/include)

# 根据平台设置特定的变量和路径
if(WIN32)
    # Windows特定设置
    set(THIRD_LIB_PATH ${PROJECT_SOURCE_DIR}/third_lib/win_install)
    set(CMAKE_PREFIX_PATH "${PROJECT_SOURCE_DIR}/third_lib/win_install")
    list(APPEND CMAKE_PREFIX_PATH "${PROJECT_SOURCE_DIR}/third_lib/win_install/jsoncpp")
    set(GTEST_ROOT "${PROJECT_SOURCE_DIR}/third_lib/win_install/googletest")
else()
    # Linux特定设置
    set(THIRD_LIB_PATH ${PROJECT_SOURCE_DIR}/third_lib/linux_install)
    set(CMAKE_PREFIX_PATH "${PROJECT_SOURCE_DIR}/third_lib/linux_install")
    list(APPEND CMAKE_PREFIX_PATH "${PROJECT_SOURCE_DIR}/third_lib/linux_install/jsoncpp")
    set(GTEST_ROOT "${PROJECT_SOURCE_DIR}/third_lib/linux_install/googletest")
endif()

# 查找必需的第三方库
find_package(glog REQUIRED)
find_package(gflags REQUIRED)
find_package(GTest REQUIRED)


# 包含第三方库的头文件目录和库目录
include_directories(${THIRD_LIB_PATH}/glog/include)
include_directories(${THIRD_LIB_PATH}/googletest/include)
include_directories(${THIRD_LIB_PATH}/gflags/include)


link_directories(${THIRD_LIB_PATH}/glog/lib)
link_directories(${THIRD_LIB_PATH}/googletest/lib)
link_directories(${THIRD_LIB_PATH}/gflags/lib)


# 添加子目录
add_subdirectory(${PROJECT_SOURCE_DIR}/src)
add_subdirectory(test)